// 题目链接：https://www.luogu.com.cn/problem/P1135

#include <iostream>
#include <algorithm>
#include <cstring>

using namespace std;

const int N = 205;

int n, a, b;
int K[N];
int ans[N];

void DFS(int floor, int sum)
{
    ans[floor] = sum;

    if (floor == b)
    {
        return;
    }

    // 如果某一次到floor时的步数sum并不比曾经的最优步数更优，那么就放弃搜索
    //  按上
    if (floor + K[floor] <= n && sum + 1 < ans[floor + K[floor]])
    {
        DFS(floor + K[floor], sum + 1);
    }
    // 按下
    if (floor - K[floor] > 0 && sum + 1 < ans[floor - K[floor]])
    {
        DFS(floor - K[floor], sum + 1);
    }
}

int main()
{
    memset(ans, 0x7f, sizeof(ans));

    scanf("%d %d %d", &n, &a, &b);
    for (int i = 1; i <= n; ++i)
    {
        scanf("%d", &K[i]);
    }

    DFS(a, 0);

    if (ans[b] != 0x7f7f7f7f)
        printf("%d\n", ans[b]);
    else
        printf("-1\n");

    return 0;
}